<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>新增资源</title>
</head>
 <body>
 <style>
 	table td{
 		padding-left:10px;
 	}
 </style>
 <script type="text/javascript">
 		var winResAdd = new Windows("res_add");
 		$(function(){
 			winResAdd.find("#resForm").form({
 				url:'$!basePath/admin/res/doAdd',
 				onSubmit: function(){
			    	var pass = winResAdd.find('#resForm').form("validate");
			    	if(pass){
			    		winResAdd.find("#ok").linkbutton("disable");
			    	}
			    	return pass; 
			    },   
			    success:function(data){
			   		var result = jQuery.parseJSON(data);   
			        if(result.isSaved){
			       		top.Notiy.success("添加成功!");
		        		winResAdd.setReturnValue(true);
						winResAdd.close();
			        }else{
			        	top.Dialog.alert("提示",result.error,"error");
			        }
			        winResAdd.find("#ok").linkbutton("enable");
			    }
 			});
 		});
		function ok(){
  			winResAdd.find('#resForm').submit();
  		}
  		function cancel(){
  			winResAdd.close();
  		}
 </script>
 <div class="easyui-layout" data-options="fit:true">
	 <div data-options="region:'center',border:false" style="background:#fff;">
		<form id="resForm" method="post" style="padding-top:10px;padding-left:15px;">
			<table width="90%">
				<tr>
					<td>上级资源：</td>
					<td>
						<select id="parentRes" name="parentId" class="easyui-combotree" style="width: 193px;" data-options="url:'$!basePath/admin/res/resTree',animate:true">
							<option selected="selected" value="0">无上级资源</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>资源名称：</td>
					<td>
						<input type="text" class="easyui-validatebox" name="name" maxlength="50" data-options="required:true" style="width: 180px;"/>
					</td>
				</tr>
				<tr>
					<td>链接地址：</td>
					<td>
						<input type="text" class="easyui-validatebox" name="url" maxlength="100" data-options="required:true" style="width: 180px;"/>
					</td>
				</tr>
				<tr>
					<td>图标/样式：</td>
					<td>
						<input type="text" class="easyui-validatebox" name="icon" maxlength="50" data-options="required:true" style="width: 180px;"/>
					</td>
				</tr>
				<tr>
					<td>描述：</td>
					<td>
						<textarea rows="5" cols="21" name="descript"></textarea>
					</td>
				</tr>
				<tr>
					<td>是否启用：</td>
					<td>
						<label>启用</label>
						<input type="radio" name="enabled" value="0" checked="checked"/>
						<label>不启用</label>
						<input type="radio" name="enabled" value="1"/>
					</td>
				</tr>
			</table>
		</form>
	 </div>
	 <div data-options="region:'south',border:false" style="text-align:center;padding:5px 0;">
		<a id="ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="ok()">确定</a>
		<a id="cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="cancel()">取消</a>
	</div>
 </div>
  </body>
</html>
